<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>


<%@ page import="java.util.Date"%>
<%@page import="java.util.Calendar" %>
<%@ page import="javax.portlet.*"%>

<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet"%>

<%@ taglib uri="http://liferay.com/tld/portlet" prefix="liferay-portlet" %>
<%@ taglib uri="http://liferay.com/tld/theme" prefix="liferay-theme" %>
<%@ taglib uri="http://liferay.com/tld/ui" prefix="liferay-ui" %>

<%@ page import="javax.portlet.PortletURL" %>
<%@ page import="com.liferay.portal.kernel.dao.search.SearchContainer" %>

<portlet:defineObjects />
<liferay-theme:defineObjects />

<%PortletPreferences prefs = renderRequest.getPreferences();%> 

<liferay-ui:tabs names="Search,Add" refresh="<%= false %>">
    <liferay-ui:section>
        <div>
            <form action="<portlet:actionURL />" name="<portlet:namespace />SearchForm" id="<portlet:namespace />SearchForm">
                    <input type="text" size="30" param="<portlet:namespace />SearchTerm" />
                    <input type="submit" name="<portlet:namespace />DoSearch" id="<portlet:namespace />DoSearch" value="Search" />
            </form>
       </div>
        <div id="<portlet:namespace />SearchResults">
            <%
            String searchResult = request.getParameter("searchResult");
                if(searchResult != null && !(searchResult.isEmpty())){
            %>
                <%= searchResult %>
            <%
                }
            %>
        </div>
    </liferay-ui:section>
    <liferay-ui:section>
       <div>
            <form action="<portlet:actionURL />" name="<portlet:namespace />AddContactForm" id="<portlet:namespace />AddContactForm">
                <table>
                    <tr>
                        <td>Name</td>
                        <td><input type="text" size="30" name="<portlet:namespace />ContactName" id="<portlet:namespace />ContactName"/></td>
                    </tr>
                    <tr>
                        <td>Contact No</td>
                        <td><input type="text" size="30" name="<portlet:namespace />ContactNumber" id="<portlet:namespace />ContactNumber"/></td>
                    </tr>
                    <tr>
                        <td>Address</td>
                        <td><liferay-ui:input-textarea param="<portlet:namespace />ContactAddress" /></td>
                    </tr>
                    <tr>
                        <td>Birth Date</td>
                        <%
                            Calendar cal = Calendar.getInstance();
                            int year = cal.get(Calendar.YEAR);
                            int day = cal.get(Calendar.DAY_OF_MONTH);
                            int month = cal.get(Calendar.MONTH);
                        %>
                        <td>
                            <liferay-ui:input-date yearValue="<%= year %>"
                                                    dayValue="<%= day %>"
                                                    monthValue="<%= month %>"
                                                    yearRangeStart="1900"
                                                    yearRangeEnd="<%= year %>"
                                                    dayParam="DobDay"
                                                    monthParam="DobMonth"
                                                    yearParam="DobYear"/>
                       </td>
                    </tr>
                    <tr>
                        <td>&nbsp;</td>
                        <td></td>
                    </tr>
                    <tr>
                        <td>
                            <input type="submit" value="Add Contact" id="<portlet:namespace />AddContact" name="<portlet:namespace />AddContact" />
                            <input type="reset" value="Reset"/>
                        </td>
                    </tr>

                </table>
            </form>
        </div>
    </liferay-ui:section>
</liferay-ui:tabs>